﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using AiXiu.Common;
using AiXiu.Model;
using AiXiu.BLL;
using AiXiu.IBLL;
using AiXiu.WebSite.Handler;
using Newtonsoft.Json;

namespace AiXiu.WebSite
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        [WebMethod]
        public static string loginSuccessful(string user)
        {
            //缓存用户信息
            TBUsers tUser = JsonConvert.DeserializeObject<TBUsers>(user);
            IdentityManager.SaveUser(tUser);

            //跳转到用户原本想要访问到的页面，如果没有就跳转到首页
            string query = HttpContext.Current.Request.UrlReferrer.Query;
            string retunrUrl = HttpUtility.ParseQueryString(query).Get("ReturnUrl");
            return string.IsNullOrWhiteSpace(retunrUrl) ? "IndexList.aspx" : retunrUrl;
        }
    }
}